﻿using Manon.ConfigCenter.Web.ApplicationCore.Entities;
using Manon.Repository;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Debug;

namespace Manon.User.Api.ApplicationCore.Entities
{
    public class ConfigCenterDbContext : ManonDbContext
    {
        public static readonly LoggerFactory loggerFactory = new LoggerFactory(new[] { new DebugLoggerProvider()});

        public ConfigCenterDbContext(DbContextOptions<ConfigCenterDbContext> options) : base(options)
        {

        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            optionsBuilder.UseLoggerFactory(loggerFactory);
        }

        public DbSet<Projects> Projects { get; set; }

        public DbSet<Environments> Environments { get; set; }
         
        public DbSet<ProjectConfigHistorys> ProjectConfigHistorys { get; set; }

        public DbSet<ProjectConfig> ProjectConfigs { get; set; }

        public DbSet<ProjectConfigApply> ProjectConfigApplys { get; set; }

        public DbSet<ProjectConfigOnline> ProjectConfigOnlines { get; set; }

        public DbSet<ProjectEnvSecret> ProjectEnvSecrets { get; set; }

        public DbSet<Users> Users { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<RoleMenus> RoleMenus { get; set; }
        public DbSet<UserProjects> RoleProjects { get; set; } 
        public DbSet<UserEnvironments> RoleEnvironments { get; set; }

    }
}
